home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  6.3 KB  |  249 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Sunday, September 15, 1991 at 11:03 PM
  4.  Fonts.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1985-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Fonts;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingFonts}
  22. {$SETC UsingFonts := 1}
  23.  
  24. {$I+}
  25. {$SETC FontsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQuickdraw}
  31. {$I $$Shell(PInterfaces)Quickdraw.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := FontsIncludes}
  34.  
  35. CONST
  36. systemFont = 0;
  37. applFont = 1;
  38. newYork = 2;
  39. geneva = 3;
  40. monaco = 4;
  41. venice = 5;
  42. london = 6;
  43. athens = 7;
  44. sanFran = 8;
  45. toronto = 9;
  46. cairo = 11;
  47. losAngeles = 12;
  48. times = 20;
  49. helvetica = 21;
  50. courier = 22;
  51. symbol = 23;
  52. mobile = 24;
  53. commandMark = 17;
  54. checkMark = 18;
  55. diamondMark = 19;
  56. appleMark = 20;
  57. propFont = 36864;
  58. prpFntH = 36865;
  59. prpFntW = 36866;
  60. prpFntHW = 36867;
  61. fixedFont = 45056;
  62. fxdFntH = 45057;
  63. fxdFntW = 45058;
  64. fxdFntHW = 45059;
  65. fontWid = 44208;
  66.  
  67. TYPE
  68. FMInput = PACKED RECORD
  69.  family: INTEGER;
  70.  size: INTEGER;
  71.  face: Style;
  72.  needBits: BOOLEAN;
  73.  device: INTEGER;
  74.  numer: Point;
  75.  denom: Point;
  76.  END;
  77.  
  78. FMOutPtr = ^FMOutput;
  79. FMOutput = PACKED RECORD
  80.  errNum: INTEGER;
  81.  fontHandle: Handle;
  82.  bold: Byte;
  83.  italic: Byte;
  84.  ulOffset: Byte;
  85.  ulShadow: Byte;
  86.  ulThick: Byte;
  87.  shadow: Byte;
  88.  extra: SignedByte;
  89.  ascent: Byte;
  90.  descent: Byte;
  91.  widMax: Byte;
  92.  leading: SignedByte;
  93.  unused: Byte;
  94.  numer: Point;
  95.  denom: Point;
  96.  END;
  97.  
  98. FontRec = RECORD
  99.  fontType: INTEGER;                        {font type}
  100.  firstChar: INTEGER;                    {ASCII code of first character}
  101.  lastChar: INTEGER;                        {ASCII code of last character}
  102.  widMax: INTEGER;                        {maximum character width}
  103.  kernMax: INTEGER;                        {negative of maximum character kern}
  104.  nDescent: INTEGER;                        {negative of descent}
  105.  fRectWidth: INTEGER;                    {width of font rectangle}
  106.  fRectHeight: INTEGER;                    {height of font rectangle}
  107.  owTLoc: INTEGER;                        {offset to offset/width table}
  108.  ascent: INTEGER;                        {ascent}
  109.  descent: INTEGER;                        {descent}
  110.  leading: INTEGER;                        {leading}
  111.  rowWords: INTEGER;                        {row width of bit image / 2 }
  112.  END;
  113.  
  114. FMetricRec = RECORD
  115.  ascent: Fixed;                            {base line to top}
  116.  descent: Fixed;                        {base line to bottom}
  117.  leading: Fixed;                        {leading between lines}
  118.  widMax: Fixed;                            {maximum character width}
  119.  wTabHandle: Handle;                    {handle to font width table}
  120.  END;
  121.  
  122. WidEntry = RECORD
  123.  widStyle: INTEGER;                        {style entry applies to}
  124.  END;
  125.  
  126. WidTable = RECORD
  127.  numWidths: INTEGER;                    {number of entries - 1}
  128.  END;
  129.  
  130. AsscEntry = RECORD
  131.  fontSize: INTEGER;
  132.  fontStyle: INTEGER;
  133.  fontID: INTEGER;                        {font resource ID}
  134.  END;
  135.  
  136. FontAssoc = RECORD
  137.  numAssoc: INTEGER;                        {number of entries - 1}
  138.  END;
  139.  
  140. StyleTable = RECORD
  141.  fontClass: INTEGER;
  142.  offset: LONGINT;
  143.  reserved: LONGINT;
  144.  indexes: ARRAY [0..47] OF SignedByte;
  145.  END;
  146.  
  147. NameTable = RECORD
  148.  stringCount: INTEGER;
  149.  baseFontName: Str255;
  150.  END;
  151.  
  152. KernPair = RECORD
  153.  kernFirst: CHAR;                        {1st character of kerned pair}
  154.  kernSecond: CHAR;                        {2nd character of kerned pair}
  155.  kernWidth: INTEGER;                    {kerning in 1pt fixed format}
  156.  END;
  157.  
  158. KernEntry = RECORD
  159.  kernLength: INTEGER;                    {length of this entry}
  160.  kernStyle: INTEGER;                    {style the entry applies to}
  161.  END;
  162.  
  163. KernTable = RECORD
  164.  numKerns: INTEGER;                        {number of kerning entries}
  165.  END;
  166.  
  167. WidthTable = PACKED RECORD
  168.  tabData: ARRAY [1..256] OF Fixed;        {character widths}
  169.  tabFont: Handle;                        {font record used to build table}
  170.  sExtra: LONGINT;                        {space extra used for table}
  171.  style: LONGINT;                        {extra due to style}
  172.  fID: INTEGER;                            {font family ID}
  173.  fSize: INTEGER;                        {font size request}
  174.  face: INTEGER;                            {style (face) request}
  175.  device: INTEGER;                        {device requested}
  176.  inNumer: Point;                        {scale factors requested}
  177.  inDenom: Point;                        {scale factors requested}
  178.  aFID: INTEGER;                            {actual font family ID for table}
  179.  fHand: Handle;                            {family record used to build up table}
  180.  usedFam: BOOLEAN;                        {used fixed point family widths}
  181.  aFace: Byte;                            {actual face produced}
  182.  vOutput: INTEGER;                        {vertical scale output value}
  183.  hOutput: INTEGER;                        {horizontal scale output value}
  184.  vFactor: INTEGER;                        {vertical scale output value}
  185.  hFactor: INTEGER;                        {horizontal scale output value}
  186.  aSize: INTEGER;                        {actual size of actual font used}
  187.  tabSize: INTEGER;                        {total size of table}
  188.  END;
  189.  
  190. FamRec = RECORD
  191.  ffFlags: INTEGER;                        {flags for family}
  192.  ffFamID: INTEGER;                        {family ID number}
  193.  ffFirstChar: INTEGER;                    {ASCII code of 1st character}
  194.  ffLastChar: INTEGER;                    {ASCII code of last character}
  195.  ffAscent: INTEGER;                        {maximum ascent for 1pt font}
  196.  ffDescent: INTEGER;                    {maximum descent for 1pt font}
  197.  ffLeading: INTEGER;                    {maximum leading for 1pt font}
  198.  ffWidMax: INTEGER;                        {maximum widMax for 1pt font}
  199.  ffWTabOff: LONGINT;                    {offset to width table}
  200.  ffKernOff: LONGINT;                    {offset to kerning table}
  201.  ffStylOff: LONGINT;                    {offset to style mapping table}
  202.  ffProperty: ARRAY [1..9] OF INTEGER;    {style property info}
  203.  ffIntl: ARRAY [1..2] OF INTEGER;        {for international use}
  204.  ffVersion: INTEGER;                    {version number}
  205.  END;
  206.  
  207.  
  208. PROCEDURE InitFonts;
  209.  INLINE $A8FE;
  210. PROCEDURE GetFontName(familyID: INTEGER;VAR name: Str255);
  211.  INLINE $A8FF;
  212. PROCEDURE GetFNum(name: Str255;VAR familyID: INTEGER);
  213.  INLINE $A900;
  214. FUNCTION RealFont(fontNum: INTEGER;size: INTEGER): BOOLEAN;
  215.  INLINE $A902;
  216. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  217.  INLINE $A903;
  218. FUNCTION FMSwapFont(inRec: FMInput): FMOutPtr;
  219.  INLINE $A901;
  220. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  221.  INLINE $A834;
  222. PROCEDURE FontMetrics(theMetrics: FMetricRec);
  223.  INLINE $A835;
  224. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  225. FUNCTION IsOutline(numer: Point;denom: Point): BOOLEAN;
  226.  INLINE $7000,$A854;
  227. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  228.  INLINE $7001,$A854;
  229. FUNCTION GetOutlinePreferred: BOOLEAN;
  230.  INLINE $7009,$A854;
  231. FUNCTION OutlineMetrics(byteCount: INTEGER;textPtr: UNIV Ptr;numer: Point;
  232.  denom: Point;VAR yMax: INTEGER;VAR yMin: INTEGER;awArray: FixedPtr;lsbArray: FixedPtr;
  233.  boundsArray: RectPtr): OSErr;
  234.  INLINE $7008,$A854;
  235. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  236.  INLINE $700A,$A854;
  237. FUNCTION GetPreserveGlyph: BOOLEAN;
  238.  INLINE $700B,$A854;
  239. FUNCTION FlushFonts: OSErr;
  240.  INLINE $700C,$A854;
  241.  
  242.  
  243. {$ENDC} { UsingFonts }
  244.  
  245. {$IFC NOT UsingIncludes}
  246.  END.
  247. {$ENDC}
  248.  
  249.